﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PsychSurvey.Classes;

namespace PsychSurvey.Admin
{
    public partial class NotifyParticipants : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            List<StudyNotificationList> Participants = StudyNotification.List();
            gridParticipants.DataSource = Participants;
            gridParticipants.DataBind();
            EmailParticipants(Participants);
        }
        public void EmailParticipants(List<StudyNotificationList> Participants)
        {
            foreach (StudyNotificationList Participant in Participants)
            {
                Email.NotifyParticipantOfSurvey(Participant.IndividualId
                    , Participant.EmailAddress
                    , Participant.StudyId
                    , Participant.ConditionId);
            }
        }
    }
}
